package ar.com.mooral.activities;



import java.util.Date;
import java.util.Hashtable;

import android.app.Activity;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import ar.com.mooral.crohn.Synchronizer;
import ar.com.mooral.crohn.application.CrohnContext;
import ar.com.mooral.data.Result;


public class IngresoUsuarioPassword extends CrohnActivity{
	
    /** Called when the activity is first created. */
    public void onCreate(Bundle savedInstanceState) {
    	
    	final Context context = this.getApplicationContext();
    	
        super.onCreate(savedInstanceState);
        setContentView(R.layout.login);

    	((EditText) findViewById(R.id.txtLoginUsername)).setText(CrohnContext.getUsername());
    	((EditText) findViewById(R.id.txtLoginPassword)).setText(CrohnContext.getPassword());

     
    	// CANCELAR
		Button btnLoginCancelar = (Button) findViewById(R.id.btnLoginCancelar);
		btnLoginCancelar.setOnClickListener (new View.OnClickListener() {
		    public void onClick(View view) {
		    	finish();
		    }
		});
    	
        // INGRESAR
		Button btnLoginIngresar = (Button) findViewById(R.id.btnLoginIngresar);
		btnLoginIngresar.setOnClickListener (new View.OnClickListener() {
		    public void onClick(View view) {
		    	// get data entered by the user
		    	EditText txtLoginUsername = (EditText) findViewById(R.id.txtLoginUsername);
		    	EditText txtLoginPassword = (EditText) findViewById(R.id.txtLoginPassword);
		    	
	    		CrohnContext.setUsername(txtLoginUsername.getText().toString());
	    		CrohnContext.setPassword(txtLoginPassword.getText().toString());
				Intent intent = new Intent();
				intent.setComponent(new ComponentName(DatosPersonales.class.getPackage().getName(), DatosPersonales.class.getName()));
				startActivity(intent);
		    }
		});

     
    }
    
}